//
//  WBWebViewController.swift
//  SwiftWeibo
//
//  Created by Lausen on 2017/5/20.
//  Copyright © 2017年 id. All rights reserved.
//

import UIKit

class WBWebViewController: WBBaseViewController {

    fileprivate lazy var webView = UIWebView(frame: UIScreen.main.bounds)

    var urlString: String?{
        
        didSet{
            
            guard let urlString = urlString,
            let url = URL(string: urlString)
                else{
                
                return
            }
            
            webView.loadRequest(URLRequest(url: url))
        }
    }
}


extension WBWebViewController{
    
    // MARK: -- 重写父类的方法,设置UI
    override func setupTableView() {
        
        //把网页加入到当前的界面中去
        view.insertSubview(webView, belowSubview: navigationBar)
        
        navItem.title = "网页"
        
        webView.backgroundColor = UIColor.white
        
        //设置webView的内边距
        webView.scrollView.contentInset.top = navigationBar.bounds.height
    }
}
